USE Liberty
GO

-- ------------------------------------------------------------------------------------------------
-- ServiceManNotes Table Create Script
-- ------------------------------------------------------------------------------------------------
SET NOCOUNT OFF
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET QUOTED_IDENTIFIER ON
SET NUMERIC_ROUNDABORT OFF
GO

PRINT 'Creating Table dbo.ServiceManNotes...'
GO

IF OBJECT_ID('dbo.ServiceManNotes', 'U') IS NULL
BEGIN
	CREATE TABLE dbo.ServiceManNotes
	(OID					bigint		IDENTITY(1, 1)	NOT NULL
	,Version				rowversion
	,ServiceManID			bigint						NOT NULL
	,Notes					varchar(MAX)				NOT NULL
	,UpdatedDate			datetime					NOT NULL
		CONSTRAINT DFLT_ServiceManNotes_UpdatedDate DEFAULT GETDATE()
	,CreatedDate			datetime					NOT NULL
		CONSTRAINT DFLT_ServiceManNotes_CreatedDate DEFAULT GETDATE()

	,CONSTRAINT PK_ServiceManNotes PRIMARY KEY CLUSTERED( OID ) --ON PRIMARY

	,CONSTRAINT FK_ServiceManNotes_ServiceMen FOREIGN KEY (ServiceManID)
		REFERENCES ServiceMen(OID)

	)

	PRINT 'Table dbo.ServiceManNotes has been created successfully.'

END
ELSE 
BEGIN
    PRINT 'Table dbo.ServiceManNotes already exists.'
END

GO
